// loop with Object.entries()
let user = {
    name: "John",
    age: 30
};

// 这样写，突然就感觉这种解构赋值的用法和python的类似语法有点像
for (let [key, value] of Object.entries(user)) {
    alert(`${key}:${value}`);
}


// and the same to map object
let user2 = new Map();

user2.set("name", "John");
user2.set("age", "30");

for (let [key, value] of user2) {
    alert(`${key}:${value}`);
}


// the skill of swap variable value
let guest = "Jane";
let admin = "Pete";

[guest, admin] = [admin, guest];

alert(`${guest} ${admin}`)